using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

//Importamos
using EventSys.BussinesEntities;

namespace EventSys.Repository.Mapping
{
    public class CarreraMap : EntityTypeConfiguration<Carrera>
    {
        public CarreraMap()
        {
            // Primary Key
            this.HasKey(t => t.idCarrera);

            //// Properties ----- se genera cuando no esta configurado el auto incremento
            //this.Property(t => t.idCarrera)
            //    .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Carrera1)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Carrera");
            this.Property(t => t.idCarrera).HasColumnName("idCarrera");
            this.Property(t => t.Carrera1).HasColumnName("Carrera");
            this.Property(t => t.idFacultad).HasColumnName("idFacultad");

            // Relationships
            this.HasOptional(t => t.Facultad)
                .WithMany(t => t.Carreras)
                .HasForeignKey(d => d.idFacultad);

        }
    }
}
